package com.example.springboot.mapper;

import com.example.springboot.controller.request.BaseRequest;
import com.example.springboot.entity.Book;
import com.example.springboot.entity.Borrow;
import com.example.springboot.entity.Returnbook;
import com.example.springboot.mapper.po.BorrowReturnCountPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Description:mapper接口注解实现方式
 *
 * @Author 马钰涵
 * @Create 2023/8/5 9:10
 * @Version 1.0
 */
@Mapper
public interface BorrowMapper {

    List<Borrow> list();

    List<Borrow> listByCondition(BaseRequest baseRequest);

    List<Returnbook> listReturnbookByCondition(BaseRequest baseRequest);

    void save(Borrow borrow);

    void saveReturnbook(Returnbook returnbook);

    Borrow getById(Integer id);

    void updateById(Borrow borrow);

    void deleteById(Integer id);

    void deleteReturnById(Integer id);

    void updateStatus(String status, Integer id);

    List<BorrowReturnCountPO> getCountByTimeRange(@Param("timeRange") String timeRange, @Param("type") int type);  // 1 borrow  2 return

    void deleteBatch(@Param("ids") List<Integer> ids);

    void deleteReturnBatch(@Param("ids") List<Integer> ids);
}
